package com.fxsh168.server.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Administrator on 2016/10/17.
 */
public class RegExp {
    //核对手机号是否正确
    public static boolean checkPhone(String phone){
        Pattern pattern=Pattern.compile("^1[0-9]{10}$");
        Matcher matcher=pattern.matcher(phone);
        return matcher.matches();
    }

    //核对密码是否符合6-18位字符或数字
    public static boolean checkPassword(String password){
        Pattern pattern=Pattern.compile("^[0-9a-zA-Z]{6,18}$");
        Matcher matcher=pattern.matcher(password);
        return matcher.matches();
    }
    //核对年龄是否是出数字
    public static boolean checkAge(String age){
        Pattern pattern=Pattern.compile("^[0-9]*$");
        Matcher matcher=pattern.matcher(age);
        return matcher.matches();
    }
}
